package com.ionehe.cola.common.util;

import org.springframework.stereotype.Component;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 线程池工具类
 *
 * @author 2022/1/24 <a href="mailto:a@ionehe.com">skedison</a>
 */
public class ExecutorUtil {
    private ExecutorUtil() {
        throw new IllegalStateException("Utility class");
    }

    private static final ThreadPoolExecutor HANDLE_THREAD_POOL =
            new ThreadPoolExecutor(20, 50, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadPoolExecutor.AbortPolicy());

    public static ThreadPoolExecutor getInstance() {
        return HANDLE_THREAD_POOL;
    }
}
